﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Protegidos/Administracao/GENTE_Adm.master" AutoEventWireup="true" CodeFile="acPatrocinadores.aspx.cs" Inherits="Protegidos_Administracao_Cadastros_acPatrocinadores" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphSubConteudo" Runat="Server">

<table width="99%" align="center">
    <tr>
        <td>
              
            <div class="Titulo01">Dados Cadastrais</div>
            <div class="Titulo02">Cadastros / Gerais / Pratrocinadores</div>

        </td>    
    </tr>
    <tr>
        <td>
            
            <table width="99%" align="right">
                <tr>
                    <td>
                        <div class="SuTituloVR">Dados de Pesquisa</div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table>               
                            <tr>
                                <td style="width: 150px"><span class="textoCZ_12">Patrocinador:</span></td>
                                <td>
                                    <telerik:RadComboBox ID="rcbOrganizacao" runat="server" Width="400px" 
                                        Height="150px" Skin="Telerik"
							            EmptyMessage="Selecione um Patrocinador" EnableLoadOnDemand="True" ShowMoreResultsBox="true"
							            EnableVirtualScrolling="true" OnItemsRequested="rcbOrganizacao_ItemsRequested" 
                                        LoadingMessage="Carregando...">
						            </telerik:RadComboBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 150px"><span class="textoCZ_12">Status:</span></td>
                                <td>
                                    <telerik:RadComboBox ID="rcbStatus" runat="server" Skin="Telerik" EmptyMessage="Todos" HighlightTemplatedItems="true"
						                AllowCustomText="true" Width="240px" OnClientDropDownClosed="onDropDownClosing">
						                <ItemTemplate>
							                <div onclick="StopPropagation(event)">
								                <asp:CheckBox runat="server" ID="chk1" Checked="true" onclick="onCheckBoxClick(this)"/>
								                <asp:Label runat="server" ID="lblDescricao" AssociatedControlID="chk1"><%# Eval("Descricao")%></asp:Label>
							                </div>
						                </ItemTemplate>
					                </telerik:RadComboBox>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                    <br />
                        <asp:Button ID="btnPesquisar" runat="server" Text="Pesquisar" Width="110px" 
                            onclick="btnPesquisar_Click" />&nbsp;&nbsp;
                        <asp:Button ID="btnIncluir" runat="server" Text="Incluir" Width="110px" 
                            onclick="btnIncluir_Click" />&nbsp;&nbsp;
                        <asp:Button ID="btnLimpar" runat="server" Text="Limpar" Width="110px" 
                            onclick="btnLimpar_Click"/>
                    </td>
                </tr>
            </table>
            
        </td>    
    </tr>
    
    <tr runat="server" id="trResultado">
        <td>
            
            <table width="99%" align="right">
                <tr>
                    <td>
                        <div class="SuTituloVR">Resultado da Pesquisa</div>
                    </td>
                </tr>
                <tr>
                    <td>
                        
                        <%--RadGrid--%>
                        
                    </td>
                </tr>
                
            </table>
            
        </td>    
    </tr>
    
</table>

<script type="text/javascript">
    /* <![CDATA[ */

    var cancelDropDownClosing = false;

    function StopPropagation(e)
    {
	    //cancel bubbling
	    e.cancelBubble = true;
	    if (e.stopPropagation)
	    {
		    e.stopPropagation();
	    }
    }

    function onDropDownClosing()
    {
	    cancelDropDownClosing = false;
    }

    function onCheckBoxClick(chk)
    {           
	    var combo = $find("<%= rcbStatus.ClientID %>");
	    //prevent second combo from closing
	    cancelDropDownClosing = true;
	    //holds the text of all checked items
	    var text = "";
	    //holds the values of all checked items
	    var values = "";
	    //get the collection of all items
	    var items = combo.get_items();
	    //enumerate all items
	    for (var i = 0; i < items.get_count(); i++)
	    {
		    var item = items.getItem(i);
		    //get the checkbox element of the current item
		    var chk1 = $get(combo.get_id() + "_i" + i + "_chk1");
		    if (chk1.checked)
		    {
			    text += item.get_text() + "," ;
			    values += item.get_value() + ",";            
		    }
	    }
	    //remove the last comma from the string
	    text = removeLastComma(text);
	    values = removeLastComma(values);
        
	    if (text.length > 0)
	    {
		    //set the text of the combobox
		    combo.set_text(text);
	    }
	    else
	    {
		    //all checkboxes are unchecked
		    //so reset the controls        
		    combo.set_text("")
	    }
    }

    //this method removes the ending comma from a string
    function removeLastComma(str)
    {
	    return str.replace(/,$/,"");
    }

/* ]]> */   
</script>

</asp:Content>

